<?php
//添加团购页面
include("../common.inc.php");
InitGP(array("action")); //初始化变量全局返回
include("function_common.php");

$titlestr="添加团购劵信息";
//初始化对象
include(INC_PATH."/groupbond.class.php");
$gb=new GroupBondClass();

if(empty($action)){
	InitGP(array("gid")); //初始化变量全局返回
	
	
	//显示添加表单
	include("tpl/groupbond_add.htm");
}elseif ($action=="save"){
	InitGP(array("gid","sn","password","endtime")); //初始化变量全局返回
	if(isset($gid)){
		//处理数据
		$gid=GetNum($gid);
		$sn=Char_cv($sn);
		$password=Char_cv($password);
		$endtime=strtotime($endtime);
		$info=$gb->add($gid,$sn,$password,$endtime);
		if($info=="OK"){
			showmsg("添加团购劵成功!","groupbond_list.php");//成功
		}else showmsg($info,"groupbond_add.php");//出错！
	}else showmsg("缺少参数","groupbond_add.php");//出错！
}


?>